import { Controller, Get, Query } from '@nestjs/common'
import { ScanLoginService } from './scan-login.service'

@Controller('qrcode')
export class ScanLoginController {
  constructor(private readonly qrcodeService: ScanLoginService) {}

  @Get('/generate')
  async generate() {
    return await this.qrcodeService.generate()
  }

  @Get('/check')
  checkQrCodeStatus(@Query('uuid') uuid: string) {
    return this.qrcodeService.checkQrCodeStatus(uuid)
  }

  @Get('/scan')
  scanQrCode(@Query('uuid') uuid: string) {
    return this.qrcodeService.scanQrCode(uuid)
  }

  @Get('/confirm')
  confirmQrCode(@Query('uuid') uuid: string) {
    return this.qrcodeService.confirmQrCode(uuid)
  }

  @Get('/cancel')
  cancelQrCode(@Query('uuid') uuid: string) {
    return this.qrcodeService.cancelQrCode(uuid)
  }
}
